Skip to content
This repository was archived by the owner on Mar 25, 2026. It is now read-only.

Add Python SDK documentation for async and agent-to-agent features#114

Merged
jhaynie merged 10 commits intomainfrom
devin/1746044643-python-sdk-async-docs
May 1, 2025
Merged

Add Python SDK documentation for async and agent-to-agent features#114
jhaynie merged 10 commits intomainfrom
devin/1746044643-python-sdk-async-docs

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot commented Apr 30, 2025

Python SDK Documentation Update

This PR adds documentation for the Python SDK's async and agent-to-agent communication features introduced in PR #38 of the sdk-py repository.

Changes

  • Added comprehensive documentation for the Python SDK:
    • Async API documentation covering asynchronous operations and streaming
    • Agent-to-Agent Communication documentation for local and remote agent interactions
    • Data Handling documentation for working with various content types
    • Updated index.mdx with getting started guide and feature cards

Implementation Details

  • Used proper type hints in all code examples
  • Included instructions for using the Agentuity CLI for installation and development
  • Added examples for streaming data and async iteration
  • Documented the new agent resolution and communication patterns

References

Verification

The documentation has been tested locally to ensure it renders correctly.

Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
@devin-ai-integration devin-ai-integration Bot requested a review from jhaynie April 30, 2025 20:27
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

agentuity new
```

## Creating Your First Agent
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this section since agentuity new creates this file.

Add the following code to your agent file:

```python
def run(request, response, context):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use types

Start the local development server:

```bash
uv run test.py
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agentuity dev should be the command to run development server

Test your agent by sending a request:

```bash
curl -v http://localhost:3500/agent_HaDpiH67c4851eISzbAWfZqwLtnpguW6 --json '{"hello":"world"}'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tell them to go to the app link in the output and use the UI

Comment thread content/docs/SDKs/python/index.mdx Outdated
## Installation

```bash
pip install agentuity
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refer to the proper installation instructions

Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
```python
async def run(request, response, context):
# Call another agent by ID
result = await response.handoff({"id": "other_agent_id"})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
result = await response.handoff({"id": "other_agent_id"})
return await response.handoff({"id": "other_agent_id"})

return result

# Or call by name
# result = await response.handoff({"name": "OtherAgentName"})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# result = await response.handoff({"name": "OtherAgentName"})
# return response.handoff({"name": "OtherAgentName"})


# Or call by name
# result = await response.handoff({"name": "OtherAgentName"})
# return result
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# return result

devin-ai-integration Bot and others added 2 commits April 30, 2025 20:50
Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
return response.binary(b"\x00\x01\x02\x03", "application/octet-stream")

# Empty response with metadata
return response.empty({"status": "processed"})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove empty since that doesn't exist

return response.text("Hello, world!")

# HTML response
return response.html("<h1>Hello, world!</h1>")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove html since it doesn't exit

@@ -0,0 +1,62 @@
---
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have most of this information in index.mdx

devin-ai-integration Bot and others added 2 commits May 1, 2025 03:08
Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
Comment thread content/docs/SDKs/python/meta.json Outdated
@@ -0,0 +1,3 @@
{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this file

Comment thread content/docs/SDKs/python/crewai.mdx Outdated
@@ -0,0 +1,20 @@
---
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this doc and references to it

devin-ai-integration Bot and others added 2 commits May 1, 2025 03:09
Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
Comment thread content/docs/SDKs/python/index.mdx Outdated
<p>Work with various data types and streaming capabilities</p>
</Card>

<Card href="/docs/SDKs/python/crewai">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
@jhaynie
Copy link
Copy Markdown
Member

jhaynie commented May 1, 2025

please re-write the PR description to reflect all the changes

```python
async def run(request, response, context):
# Resolve an agent (local or remote)
agent = context.get_agent("remote_agent_id")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
agent = context.get_agent("remote_agent_id")
agent = context.get_agent({"id": "remote_agent_id"})


async def run(request, response, context):
# Resolve by ID
agent = resolve_agent(context, "agent_id")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use context.get_agent({"id": "agent_id"}) instead of resolve_agent which is meant to be internal

…parameters

Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
@jhaynie jhaynie merged commit b980c43 into main May 1, 2025
@jhaynie jhaynie deleted the devin/1746044643-python-sdk-async-docs branch May 1, 2025 03:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant